<template>
    <el-dialog v-model="props.visible" title="调拨申请" @close="handleClose" width="25%" destroy-on-close>
        <el-form :model="applyFormData" ref="applyFormRef">
            <el-form-item label="部件名称">
                <span>{{ props.data.componentName }}</span>
            </el-form-item>
            <el-form-item label="发出仓库">
                <span>{{ props.data.warehouseName }}</span>
            </el-form-item>
            <el-form-item label="到货仓库" prop="toWareHouse">
                <el-select v-model="applyFormData.toWareHouse" placeholder="请选择">
                    <el-option label="报废仓" value="1"></el-option>
                    <el-option label="三江仓" value="2"></el-option>
                    <el-option label="吕广才库" value="3"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="调拨数量" prop="applyNumber">
                <el-input v-model.number="applyFormData.applyNumber" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="到货日期" prop="date">
                <el-date-picker v-model="applyFormData.date" placeholder="年/月/日" type="date" format="YYYY/MM/DD" />
            </el-form-item>
            <el-form-item label="备注" prop="remark">
                <el-input type="textarea" v-model="applyFormData.remark" placeholder="请输入" maxlength="125" show-word-limit></el-input>
            </el-form-item>
        </el-form>
        <template #footer>
            <div class="dialog-footer">
                <el-button  type="primary" >确 定</el-button>
                <el-button @click="handleClose">取 消</el-button>
            </div>
        </template>
    </el-dialog>
</template>

<script setup lang="ts">
import type { FormInstance } from 'element-plus';
import {ref} from 'vue';

const props = defineProps(['visible','data']);
const emits = defineEmits(['close']);
const applyFormRef = ref<FormInstance>();
const applyFormData = ref({
    toWareHouse: undefined,
    applyNumber: undefined,
    date: undefined,
    remark: undefined
});

const handleClose = ()=>{
    applyFormRef.value?.resetFields();
    emits('close');
};

</script>

<style lang="scss" scoped>
.dialog-footer{
    display: flex;
    justify-content: center;
}
</style>